from flask import Flask, render_template, request

app = Flask(__name__)
app.config['SECRET_KEY'] = 'demo4'

from flask_bootstrap import Bootstrap

bootstrap = Bootstrap()
bootstrap.init_app(app)
bootstrap_cdns = app.extensions['bootstrap']['cdns']
bootstrap_cdns['bootstrap'] = bootstrap_cdns['local']
bootstrap_cdns['jquery'] = bootstrap_cdns['local']


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/form', methods=['GET', 'POST'])
def form():
    # args用于获取GET方式提交的数据
    msg_get = request.args.get('msg_get')
    # form用于获取POST方式提交数据
    msg_post = request.form.get('msg_post')
    return render_template('form.html', msg_get=msg_get, msg_post=msg_post)


if __name__ == "__main__":
    app.run(debug=True)
